package com.chinaums.fsp.sdk.request;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;

import com.chinaums.fsp.base.pgt.TransType;
import com.chinaums.fsp.sdk.base.RequestData;
import com.chinaums.fsp.sdk.base.ResponseDataWrapper;
import com.chinaums.fsp.sdk.pgt.params.DiscountDataQueryRequest;
import com.chinaums.fsp.sdk.pgt.params.DiscountDataQueryResponse;
import com.google.gson.Gson;
/**
 * 贴现数据查询
 * @author hty
 *
 */
public class DraftDiscountDataQueryTest extends BaseRequest{
	
	public void testDraftDiscountDataQueryRequest() throws Exception {

		PgtRequestFactory rf = FACTORY.factory();

		RequestData.Builder builder = this.createRequestDataBuilder();
		builder.setTransType(TransType.DRAFT_DISCOUNT_DATA_QUERY.getTransCode());
		String DraftNumberArray = this.createDraft();
		DiscountDataQueryRequest data = DiscountDataQueryRequest.newBuilder()
				.setDraftNumberArray(DraftNumberArray)
				.build();
		rf.transType(TransType.DRAFT_DISCOUNT_DATA_QUERY.getTransCode()).responseClass(DiscountDataQueryResponse.class)
				.data(data);

		ResponseDataWrapper rdw = rf.post();
		this.printToDraft(rdw);
	}

	private String createDraft() {
		List<Map<String, String>> list = new ArrayList<>();
		Map<String, String> map = new TreeMap<String, String>();
		map.put("draftNumber", "130129005084420200116570115139");
		list.add(map);
		String jsonStr = new Gson().toJson(list);
		return jsonStr;
	}

}
